/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

// Created on 31.10.2003 by RST.
// $Id: gclient_t.java,v 1.7 2006/01/21 21:53:32 salomo Exp $
using System;
using Com = Suake2.UI.qcommon.Com;
using Lib = Suake2.UI.util.Lib;
using QuakeFile = Suake2.UI.util.QuakeFile;
//UPGRADE_TODO: The type 'java.nio.ByteBuffer' could not be found. If it was not included in the conversion, there may be compiler issues. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1262'"
using ByteBuffer = java.nio.ByteBuffer;
namespace Suake2.UI.game
{
	
	public class gclient_t
	{
		
		public gclient_t(int index)
		{
			this.index = index;
		}
		//	this structure is cleared on each PutClientInServer(),
		//	except for 'client->pers'
		
		// known to server
		public player_state_t ps = new player_state_t(); // communicated by server to clients
		public int ping;
		
		// private to game
		public client_persistant_t pers = new client_persistant_t();
		public client_respawn_t resp = new client_respawn_t();
		public pmove_state_t old_pmove = new pmove_state_t(); // for detecting out-of-pmove changes
		
		public bool showscores; // set layout stat
		public bool showinventory; // set layout stat
		public bool showhelp;
		public bool showhelpicon;
		
		public int ammo_index;
		
		public int buttons;
		public int oldbuttons;
		public int latched_buttons;
		
		public bool weapon_thunk;
		
		public gitem_t newweapon;
		
		// sum up damage over an entire frame, so
		// shotgun blasts give a single big kick
		public int damage_armor; // damage absorbed by armor
		public int damage_parmor; // damage absorbed by power armor
		public int damage_blood; // damage taken out of health
		public int damage_knockback; // impact damage
		public float[] damage_from = new float[]{0, 0, 0}; // origin for vector calculation
		
		public float killer_yaw; // when dead, look at killer
		
		public int weaponstate;
		public float[] kick_angles = new float[]{0, 0, 0}; // weapon kicks
		public float[] kick_origin = new float[]{0, 0, 0};
		public float v_dmg_roll, v_dmg_pitch, v_dmg_time; // damage kicks
		public float fall_time, fall_value; // for view drop on fall
		public float damage_alpha;
		public float bonus_alpha;
		public float[] damage_blend = new float[]{0, 0, 0};
		public float[] v_angle = new float[]{0, 0, 0}; // aiming direction
		public float bobtime; // so off-ground doesn't change it
		public float[] oldviewangles = new float[]{0, 0, 0};
		public float[] oldvelocity = new float[]{0, 0, 0};
		
		public float next_drown_time;
		public int old_waterlevel;
		public int breather_sound;
		
		public int machinegun_shots; // for weapon raising
		
		// animation vars
		public int anim_end;
		public int anim_priority;
		public bool anim_duck;
		public bool anim_run;
		
		// powerup timers
		public float quad_framenum;
		public float invincible_framenum;
		public float breather_framenum;
		public float enviro_framenum;
		
		public bool grenade_blew_up;
		public float grenade_time;
		public int silencer_shots;
		public int weapon_sound;
		
		public float pickup_msg_time;
		
		public float flood_locktill; // locked from talking
		public float[] flood_when = new float[10]; // when messages were said
		public int flood_whenhead; // head pointer for when said
		
		public float respawn_time; // can respawn when time > this
		
		public edict_t chase_target; // player we are chasing
		public bool update_chase; // need to update chase info?
		
		public int index;
		
		/// <summary>Clears the game client structure. </summary>
		public virtual void  clear()
		{
			ping = 0;
			
			pers = new client_persistant_t();
			resp = new client_respawn_t();
			old_pmove = new pmove_state_t();
			
			showscores = false; // set layout stat
			showinventory = false; // set layout stat
			showhelp = false;
			showhelpicon = false;
			
			ammo_index = 0;
			
			buttons = oldbuttons = latched_buttons = 0;
			weapon_thunk = false;
			newweapon = null;
			damage_armor = 0;
			damage_parmor = 0;
			damage_blood = 0;
			damage_knockback = 0;
			
			killer_yaw = 0;
			damage_from = new float[3];
			weaponstate = 0;
			kick_angles = new float[3];
			kick_origin = new float[3];
			v_dmg_roll = v_dmg_pitch = v_dmg_time = 0;
			fall_time = fall_value = 0;
			damage_alpha = 0;
			bonus_alpha = 0;
			damage_blend = new float[3];
			v_angle = new float[3];
			bobtime = 0;
			
			oldviewangles = new float[3];
			
			oldvelocity = new float[3];
			
			next_drown_time = 0;
			
			old_waterlevel = 0;
			
			breather_sound = 0;
			machinegun_shots = 0;
			
			anim_end = 0;
			anim_priority = 0;
			anim_duck = false;
			anim_run = false;
			
			// powerup timers
			quad_framenum = 0;
			invincible_framenum = 0;
			breather_framenum = 0;
			enviro_framenum = 0;
			
			grenade_blew_up = false;
			grenade_time = 0;
			silencer_shots = 0;
			weapon_sound = 0;
			
			pickup_msg_time = 0;
			
			flood_locktill = 0; // locked from talking
			flood_when = new float[10]; // when messages were said
			flood_whenhead = 0; // head pointer for when said
			
			respawn_time = 0; // can respawn when time > this
			
			chase_target = null; // player we are chasing
			update_chase = false; // need to update chase info?
		}
		
		/// <summary>Reads a game client from the file. </summary>
		public virtual void  read(QuakeFile f)
		{
			
			ps.load(f);
			
			System.IO.BinaryReader temp_BinaryReader;
			temp_BinaryReader = new System.IO.BinaryReader(f);
			temp_BinaryReader.BaseStream.Position = f.Position;
			ping = temp_BinaryReader.ReadInt32();
			
			pers.read(f);
			resp.read(f);
			
			old_pmove.load(f);
			
			System.IO.BinaryReader temp_BinaryReader2;
			temp_BinaryReader2 = new System.IO.BinaryReader(f);
			temp_BinaryReader2.BaseStream.Position = f.Position;
			showscores = temp_BinaryReader2.ReadInt32() != 0;
			System.IO.BinaryReader temp_BinaryReader3;
			temp_BinaryReader3 = new System.IO.BinaryReader(f);
			temp_BinaryReader3.BaseStream.Position = f.Position;
			showinventory = temp_BinaryReader3.ReadInt32() != 0;
			System.IO.BinaryReader temp_BinaryReader4;
			temp_BinaryReader4 = new System.IO.BinaryReader(f);
			temp_BinaryReader4.BaseStream.Position = f.Position;
			showhelp = temp_BinaryReader4.ReadInt32() != 0;
			System.IO.BinaryReader temp_BinaryReader5;
			temp_BinaryReader5 = new System.IO.BinaryReader(f);
			temp_BinaryReader5.BaseStream.Position = f.Position;
			showhelpicon = temp_BinaryReader5.ReadInt32() != 0;
			System.IO.BinaryReader temp_BinaryReader6;
			temp_BinaryReader6 = new System.IO.BinaryReader(f);
			temp_BinaryReader6.BaseStream.Position = f.Position;
			ammo_index = temp_BinaryReader6.ReadInt32();
			
			System.IO.BinaryReader temp_BinaryReader7;
			temp_BinaryReader7 = new System.IO.BinaryReader(f);
			temp_BinaryReader7.BaseStream.Position = f.Position;
			buttons = temp_BinaryReader7.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader8;
			temp_BinaryReader8 = new System.IO.BinaryReader(f);
			temp_BinaryReader8.BaseStream.Position = f.Position;
			oldbuttons = temp_BinaryReader8.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader9;
			temp_BinaryReader9 = new System.IO.BinaryReader(f);
			temp_BinaryReader9.BaseStream.Position = f.Position;
			latched_buttons = temp_BinaryReader9.ReadInt32();
			
			System.IO.BinaryReader temp_BinaryReader10;
			temp_BinaryReader10 = new System.IO.BinaryReader(f);
			temp_BinaryReader10.BaseStream.Position = f.Position;
			weapon_thunk = temp_BinaryReader10.ReadInt32() != 0;
			
			newweapon = f.readItem();
			
			
			System.IO.BinaryReader temp_BinaryReader11;
			temp_BinaryReader11 = new System.IO.BinaryReader(f);
			temp_BinaryReader11.BaseStream.Position = f.Position;
			damage_armor = temp_BinaryReader11.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader12;
			temp_BinaryReader12 = new System.IO.BinaryReader(f);
			temp_BinaryReader12.BaseStream.Position = f.Position;
			damage_parmor = temp_BinaryReader12.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader13;
			temp_BinaryReader13 = new System.IO.BinaryReader(f);
			temp_BinaryReader13.BaseStream.Position = f.Position;
			damage_blood = temp_BinaryReader13.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader14;
			temp_BinaryReader14 = new System.IO.BinaryReader(f);
			temp_BinaryReader14.BaseStream.Position = f.Position;
			damage_knockback = temp_BinaryReader14.ReadInt32();
			
			System.IO.BinaryReader temp_BinaryReader15;
			temp_BinaryReader15 = new System.IO.BinaryReader(f);
			temp_BinaryReader15.BaseStream.Position = f.Position;
			damage_from[0] = temp_BinaryReader15.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader16;
			temp_BinaryReader16 = new System.IO.BinaryReader(f);
			temp_BinaryReader16.BaseStream.Position = f.Position;
			damage_from[1] = temp_BinaryReader16.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader17;
			temp_BinaryReader17 = new System.IO.BinaryReader(f);
			temp_BinaryReader17.BaseStream.Position = f.Position;
			damage_from[2] = temp_BinaryReader17.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader18;
			temp_BinaryReader18 = new System.IO.BinaryReader(f);
			temp_BinaryReader18.BaseStream.Position = f.Position;
			killer_yaw = temp_BinaryReader18.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader19;
			temp_BinaryReader19 = new System.IO.BinaryReader(f);
			temp_BinaryReader19.BaseStream.Position = f.Position;
			weaponstate = temp_BinaryReader19.ReadInt32();
			
			System.IO.BinaryReader temp_BinaryReader20;
			temp_BinaryReader20 = new System.IO.BinaryReader(f);
			temp_BinaryReader20.BaseStream.Position = f.Position;
			kick_angles[0] = temp_BinaryReader20.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader21;
			temp_BinaryReader21 = new System.IO.BinaryReader(f);
			temp_BinaryReader21.BaseStream.Position = f.Position;
			kick_angles[1] = temp_BinaryReader21.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader22;
			temp_BinaryReader22 = new System.IO.BinaryReader(f);
			temp_BinaryReader22.BaseStream.Position = f.Position;
			kick_angles[2] = temp_BinaryReader22.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader23;
			temp_BinaryReader23 = new System.IO.BinaryReader(f);
			temp_BinaryReader23.BaseStream.Position = f.Position;
			kick_origin[0] = temp_BinaryReader23.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader24;
			temp_BinaryReader24 = new System.IO.BinaryReader(f);
			temp_BinaryReader24.BaseStream.Position = f.Position;
			kick_origin[1] = temp_BinaryReader24.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader25;
			temp_BinaryReader25 = new System.IO.BinaryReader(f);
			temp_BinaryReader25.BaseStream.Position = f.Position;
			kick_origin[2] = temp_BinaryReader25.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader26;
			temp_BinaryReader26 = new System.IO.BinaryReader(f);
			temp_BinaryReader26.BaseStream.Position = f.Position;
			v_dmg_roll = temp_BinaryReader26.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader27;
			temp_BinaryReader27 = new System.IO.BinaryReader(f);
			temp_BinaryReader27.BaseStream.Position = f.Position;
			v_dmg_pitch = temp_BinaryReader27.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader28;
			temp_BinaryReader28 = new System.IO.BinaryReader(f);
			temp_BinaryReader28.BaseStream.Position = f.Position;
			v_dmg_time = temp_BinaryReader28.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader29;
			temp_BinaryReader29 = new System.IO.BinaryReader(f);
			temp_BinaryReader29.BaseStream.Position = f.Position;
			fall_time = temp_BinaryReader29.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader30;
			temp_BinaryReader30 = new System.IO.BinaryReader(f);
			temp_BinaryReader30.BaseStream.Position = f.Position;
			fall_value = temp_BinaryReader30.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader31;
			temp_BinaryReader31 = new System.IO.BinaryReader(f);
			temp_BinaryReader31.BaseStream.Position = f.Position;
			damage_alpha = temp_BinaryReader31.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader32;
			temp_BinaryReader32 = new System.IO.BinaryReader(f);
			temp_BinaryReader32.BaseStream.Position = f.Position;
			bonus_alpha = temp_BinaryReader32.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader33;
			temp_BinaryReader33 = new System.IO.BinaryReader(f);
			temp_BinaryReader33.BaseStream.Position = f.Position;
			damage_blend[0] = temp_BinaryReader33.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader34;
			temp_BinaryReader34 = new System.IO.BinaryReader(f);
			temp_BinaryReader34.BaseStream.Position = f.Position;
			damage_blend[1] = temp_BinaryReader34.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader35;
			temp_BinaryReader35 = new System.IO.BinaryReader(f);
			temp_BinaryReader35.BaseStream.Position = f.Position;
			damage_blend[2] = temp_BinaryReader35.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader36;
			temp_BinaryReader36 = new System.IO.BinaryReader(f);
			temp_BinaryReader36.BaseStream.Position = f.Position;
			v_angle[0] = temp_BinaryReader36.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader37;
			temp_BinaryReader37 = new System.IO.BinaryReader(f);
			temp_BinaryReader37.BaseStream.Position = f.Position;
			v_angle[1] = temp_BinaryReader37.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader38;
			temp_BinaryReader38 = new System.IO.BinaryReader(f);
			temp_BinaryReader38.BaseStream.Position = f.Position;
			v_angle[2] = temp_BinaryReader38.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader39;
			temp_BinaryReader39 = new System.IO.BinaryReader(f);
			temp_BinaryReader39.BaseStream.Position = f.Position;
			bobtime = temp_BinaryReader39.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader40;
			temp_BinaryReader40 = new System.IO.BinaryReader(f);
			temp_BinaryReader40.BaseStream.Position = f.Position;
			oldviewangles[0] = temp_BinaryReader40.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader41;
			temp_BinaryReader41 = new System.IO.BinaryReader(f);
			temp_BinaryReader41.BaseStream.Position = f.Position;
			oldviewangles[1] = temp_BinaryReader41.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader42;
			temp_BinaryReader42 = new System.IO.BinaryReader(f);
			temp_BinaryReader42.BaseStream.Position = f.Position;
			oldviewangles[2] = temp_BinaryReader42.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader43;
			temp_BinaryReader43 = new System.IO.BinaryReader(f);
			temp_BinaryReader43.BaseStream.Position = f.Position;
			oldvelocity[0] = temp_BinaryReader43.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader44;
			temp_BinaryReader44 = new System.IO.BinaryReader(f);
			temp_BinaryReader44.BaseStream.Position = f.Position;
			oldvelocity[1] = temp_BinaryReader44.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader45;
			temp_BinaryReader45 = new System.IO.BinaryReader(f);
			temp_BinaryReader45.BaseStream.Position = f.Position;
			oldvelocity[2] = temp_BinaryReader45.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader46;
			temp_BinaryReader46 = new System.IO.BinaryReader(f);
			temp_BinaryReader46.BaseStream.Position = f.Position;
			next_drown_time = temp_BinaryReader46.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader47;
			temp_BinaryReader47 = new System.IO.BinaryReader(f);
			temp_BinaryReader47.BaseStream.Position = f.Position;
			old_waterlevel = temp_BinaryReader47.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader48;
			temp_BinaryReader48 = new System.IO.BinaryReader(f);
			temp_BinaryReader48.BaseStream.Position = f.Position;
			breather_sound = temp_BinaryReader48.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader49;
			temp_BinaryReader49 = new System.IO.BinaryReader(f);
			temp_BinaryReader49.BaseStream.Position = f.Position;
			machinegun_shots = temp_BinaryReader49.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader50;
			temp_BinaryReader50 = new System.IO.BinaryReader(f);
			temp_BinaryReader50.BaseStream.Position = f.Position;
			anim_end = temp_BinaryReader50.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader51;
			temp_BinaryReader51 = new System.IO.BinaryReader(f);
			temp_BinaryReader51.BaseStream.Position = f.Position;
			anim_priority = temp_BinaryReader51.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader52;
			temp_BinaryReader52 = new System.IO.BinaryReader(f);
			temp_BinaryReader52.BaseStream.Position = f.Position;
			anim_duck = temp_BinaryReader52.ReadInt32() != 0;
			System.IO.BinaryReader temp_BinaryReader53;
			temp_BinaryReader53 = new System.IO.BinaryReader(f);
			temp_BinaryReader53.BaseStream.Position = f.Position;
			anim_run = temp_BinaryReader53.ReadInt32() != 0;
			
			System.IO.BinaryReader temp_BinaryReader54;
			temp_BinaryReader54 = new System.IO.BinaryReader(f);
			temp_BinaryReader54.BaseStream.Position = f.Position;
			quad_framenum = temp_BinaryReader54.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader55;
			temp_BinaryReader55 = new System.IO.BinaryReader(f);
			temp_BinaryReader55.BaseStream.Position = f.Position;
			invincible_framenum = temp_BinaryReader55.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader56;
			temp_BinaryReader56 = new System.IO.BinaryReader(f);
			temp_BinaryReader56.BaseStream.Position = f.Position;
			breather_framenum = temp_BinaryReader56.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader57;
			temp_BinaryReader57 = new System.IO.BinaryReader(f);
			temp_BinaryReader57.BaseStream.Position = f.Position;
			enviro_framenum = temp_BinaryReader57.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader58;
			temp_BinaryReader58 = new System.IO.BinaryReader(f);
			temp_BinaryReader58.BaseStream.Position = f.Position;
			grenade_blew_up = temp_BinaryReader58.ReadInt32() != 0;
			System.IO.BinaryReader temp_BinaryReader59;
			temp_BinaryReader59 = new System.IO.BinaryReader(f);
			temp_BinaryReader59.BaseStream.Position = f.Position;
			grenade_time = temp_BinaryReader59.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader60;
			temp_BinaryReader60 = new System.IO.BinaryReader(f);
			temp_BinaryReader60.BaseStream.Position = f.Position;
			silencer_shots = temp_BinaryReader60.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader61;
			temp_BinaryReader61 = new System.IO.BinaryReader(f);
			temp_BinaryReader61.BaseStream.Position = f.Position;
			weapon_sound = temp_BinaryReader61.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader62;
			temp_BinaryReader62 = new System.IO.BinaryReader(f);
			temp_BinaryReader62.BaseStream.Position = f.Position;
			pickup_msg_time = temp_BinaryReader62.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader63;
			temp_BinaryReader63 = new System.IO.BinaryReader(f);
			temp_BinaryReader63.BaseStream.Position = f.Position;
			flood_locktill = temp_BinaryReader63.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader64;
			temp_BinaryReader64 = new System.IO.BinaryReader(f);
			temp_BinaryReader64.BaseStream.Position = f.Position;
			flood_when[0] = temp_BinaryReader64.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader65;
			temp_BinaryReader65 = new System.IO.BinaryReader(f);
			temp_BinaryReader65.BaseStream.Position = f.Position;
			flood_when[1] = temp_BinaryReader65.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader66;
			temp_BinaryReader66 = new System.IO.BinaryReader(f);
			temp_BinaryReader66.BaseStream.Position = f.Position;
			flood_when[2] = temp_BinaryReader66.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader67;
			temp_BinaryReader67 = new System.IO.BinaryReader(f);
			temp_BinaryReader67.BaseStream.Position = f.Position;
			flood_when[3] = temp_BinaryReader67.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader68;
			temp_BinaryReader68 = new System.IO.BinaryReader(f);
			temp_BinaryReader68.BaseStream.Position = f.Position;
			flood_when[4] = temp_BinaryReader68.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader69;
			temp_BinaryReader69 = new System.IO.BinaryReader(f);
			temp_BinaryReader69.BaseStream.Position = f.Position;
			flood_when[5] = temp_BinaryReader69.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader70;
			temp_BinaryReader70 = new System.IO.BinaryReader(f);
			temp_BinaryReader70.BaseStream.Position = f.Position;
			flood_when[6] = temp_BinaryReader70.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader71;
			temp_BinaryReader71 = new System.IO.BinaryReader(f);
			temp_BinaryReader71.BaseStream.Position = f.Position;
			flood_when[7] = temp_BinaryReader71.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader72;
			temp_BinaryReader72 = new System.IO.BinaryReader(f);
			temp_BinaryReader72.BaseStream.Position = f.Position;
			flood_when[8] = temp_BinaryReader72.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader73;
			temp_BinaryReader73 = new System.IO.BinaryReader(f);
			temp_BinaryReader73.BaseStream.Position = f.Position;
			flood_when[9] = temp_BinaryReader73.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader74;
			temp_BinaryReader74 = new System.IO.BinaryReader(f);
			temp_BinaryReader74.BaseStream.Position = f.Position;
			flood_whenhead = temp_BinaryReader74.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader75;
			temp_BinaryReader75 = new System.IO.BinaryReader(f);
			temp_BinaryReader75.BaseStream.Position = f.Position;
			respawn_time = temp_BinaryReader75.ReadSingle();
			chase_target = f.readEdictRef();
			System.IO.BinaryReader temp_BinaryReader76;
			temp_BinaryReader76 = new System.IO.BinaryReader(f);
			temp_BinaryReader76.BaseStream.Position = f.Position;
			update_chase = temp_BinaryReader76.ReadInt32() != 0;
			
			System.IO.BinaryReader temp_BinaryReader77;
			temp_BinaryReader77 = new System.IO.BinaryReader(f);
			temp_BinaryReader77.BaseStream.Position = f.Position;
			if (temp_BinaryReader77.ReadInt32() != 8765)
				System.Console.Error.WriteLine("game client load failed for num=" + index);
		}
		
		/// <summary>Writes a game_client_t (a player) to a file. </summary>
		public virtual void  write(QuakeFile f)
		{
			ps.write(f);
			
			System.IO.BinaryWriter temp_BinaryWriter;
			temp_BinaryWriter = new System.IO.BinaryWriter(f);
			temp_BinaryWriter.Write((System.Int32) ping);
			
			pers.write(f);
			resp.write(f);
			
			old_pmove.write(f);
			
			System.IO.BinaryWriter temp_BinaryWriter2;
			temp_BinaryWriter2 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter2.Write((System.Int32) (showscores?1:0));
			System.IO.BinaryWriter temp_BinaryWriter3;
			temp_BinaryWriter3 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter3.Write((System.Int32) (showinventory?1:0));
			System.IO.BinaryWriter temp_BinaryWriter4;
			temp_BinaryWriter4 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter4.Write((System.Int32) (showhelp?1:0));
			System.IO.BinaryWriter temp_BinaryWriter5;
			temp_BinaryWriter5 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter5.Write((System.Int32) (showhelpicon?1:0));
			System.IO.BinaryWriter temp_BinaryWriter6;
			temp_BinaryWriter6 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter6.Write((System.Int32) ammo_index);
			
			System.IO.BinaryWriter temp_BinaryWriter7;
			temp_BinaryWriter7 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter7.Write((System.Int32) buttons);
			System.IO.BinaryWriter temp_BinaryWriter8;
			temp_BinaryWriter8 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter8.Write((System.Int32) oldbuttons);
			System.IO.BinaryWriter temp_BinaryWriter9;
			temp_BinaryWriter9 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter9.Write((System.Int32) latched_buttons);
			
			System.IO.BinaryWriter temp_BinaryWriter10;
			temp_BinaryWriter10 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter10.Write((System.Int32) (weapon_thunk?1:0));
			f.writeItem(newweapon);
			
			
			System.IO.BinaryWriter temp_BinaryWriter11;
			temp_BinaryWriter11 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter11.Write((System.Int32) damage_armor);
			System.IO.BinaryWriter temp_BinaryWriter12;
			temp_BinaryWriter12 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter12.Write((System.Int32) damage_parmor);
			System.IO.BinaryWriter temp_BinaryWriter13;
			temp_BinaryWriter13 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter13.Write((System.Int32) damage_blood);
			System.IO.BinaryWriter temp_BinaryWriter14;
			temp_BinaryWriter14 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter14.Write((System.Int32) damage_knockback);
			
			System.IO.BinaryWriter temp_BinaryWriter15;
			temp_BinaryWriter15 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter15.Write((System.Single) damage_from[0]);
			System.IO.BinaryWriter temp_BinaryWriter16;
			temp_BinaryWriter16 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter16.Write((System.Single) damage_from[1]);
			System.IO.BinaryWriter temp_BinaryWriter17;
			temp_BinaryWriter17 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter17.Write((System.Single) damage_from[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter18;
			temp_BinaryWriter18 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter18.Write((System.Single) killer_yaw);
			
			System.IO.BinaryWriter temp_BinaryWriter19;
			temp_BinaryWriter19 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter19.Write((System.Int32) weaponstate);
			
			System.IO.BinaryWriter temp_BinaryWriter20;
			temp_BinaryWriter20 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter20.Write((System.Single) kick_angles[0]);
			System.IO.BinaryWriter temp_BinaryWriter21;
			temp_BinaryWriter21 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter21.Write((System.Single) kick_angles[1]);
			System.IO.BinaryWriter temp_BinaryWriter22;
			temp_BinaryWriter22 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter22.Write((System.Single) kick_angles[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter23;
			temp_BinaryWriter23 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter23.Write((System.Single) kick_origin[0]);
			System.IO.BinaryWriter temp_BinaryWriter24;
			temp_BinaryWriter24 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter24.Write((System.Single) kick_origin[1]);
			System.IO.BinaryWriter temp_BinaryWriter25;
			temp_BinaryWriter25 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter25.Write((System.Single) kick_origin[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter26;
			temp_BinaryWriter26 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter26.Write((System.Single) v_dmg_roll);
			System.IO.BinaryWriter temp_BinaryWriter27;
			temp_BinaryWriter27 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter27.Write((System.Single) v_dmg_pitch);
			System.IO.BinaryWriter temp_BinaryWriter28;
			temp_BinaryWriter28 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter28.Write((System.Single) v_dmg_time);
			System.IO.BinaryWriter temp_BinaryWriter29;
			temp_BinaryWriter29 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter29.Write((System.Single) fall_time);
			System.IO.BinaryWriter temp_BinaryWriter30;
			temp_BinaryWriter30 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter30.Write((System.Single) fall_value);
			System.IO.BinaryWriter temp_BinaryWriter31;
			temp_BinaryWriter31 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter31.Write((System.Single) damage_alpha);
			System.IO.BinaryWriter temp_BinaryWriter32;
			temp_BinaryWriter32 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter32.Write((System.Single) bonus_alpha);
			
			System.IO.BinaryWriter temp_BinaryWriter33;
			temp_BinaryWriter33 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter33.Write((System.Single) damage_blend[0]);
			System.IO.BinaryWriter temp_BinaryWriter34;
			temp_BinaryWriter34 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter34.Write((System.Single) damage_blend[1]);
			System.IO.BinaryWriter temp_BinaryWriter35;
			temp_BinaryWriter35 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter35.Write((System.Single) damage_blend[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter36;
			temp_BinaryWriter36 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter36.Write((System.Single) v_angle[0]);
			System.IO.BinaryWriter temp_BinaryWriter37;
			temp_BinaryWriter37 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter37.Write((System.Single) v_angle[1]);
			System.IO.BinaryWriter temp_BinaryWriter38;
			temp_BinaryWriter38 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter38.Write((System.Single) v_angle[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter39;
			temp_BinaryWriter39 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter39.Write((System.Single) bobtime);
			
			System.IO.BinaryWriter temp_BinaryWriter40;
			temp_BinaryWriter40 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter40.Write((System.Single) oldviewangles[0]);
			System.IO.BinaryWriter temp_BinaryWriter41;
			temp_BinaryWriter41 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter41.Write((System.Single) oldviewangles[1]);
			System.IO.BinaryWriter temp_BinaryWriter42;
			temp_BinaryWriter42 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter42.Write((System.Single) oldviewangles[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter43;
			temp_BinaryWriter43 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter43.Write((System.Single) oldvelocity[0]);
			System.IO.BinaryWriter temp_BinaryWriter44;
			temp_BinaryWriter44 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter44.Write((System.Single) oldvelocity[1]);
			System.IO.BinaryWriter temp_BinaryWriter45;
			temp_BinaryWriter45 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter45.Write((System.Single) oldvelocity[2]);
			
			System.IO.BinaryWriter temp_BinaryWriter46;
			temp_BinaryWriter46 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter46.Write((System.Single) next_drown_time);
			
			System.IO.BinaryWriter temp_BinaryWriter47;
			temp_BinaryWriter47 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter47.Write((System.Int32) old_waterlevel);
			System.IO.BinaryWriter temp_BinaryWriter48;
			temp_BinaryWriter48 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter48.Write((System.Int32) breather_sound);
			System.IO.BinaryWriter temp_BinaryWriter49;
			temp_BinaryWriter49 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter49.Write((System.Int32) machinegun_shots);
			System.IO.BinaryWriter temp_BinaryWriter50;
			temp_BinaryWriter50 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter50.Write((System.Int32) anim_end);
			System.IO.BinaryWriter temp_BinaryWriter51;
			temp_BinaryWriter51 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter51.Write((System.Int32) anim_priority);
			System.IO.BinaryWriter temp_BinaryWriter52;
			temp_BinaryWriter52 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter52.Write((System.Int32) (anim_duck?1:0));
			System.IO.BinaryWriter temp_BinaryWriter53;
			temp_BinaryWriter53 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter53.Write((System.Int32) (anim_run?1:0));
			
			System.IO.BinaryWriter temp_BinaryWriter54;
			temp_BinaryWriter54 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter54.Write((System.Single) quad_framenum);
			System.IO.BinaryWriter temp_BinaryWriter55;
			temp_BinaryWriter55 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter55.Write((System.Single) invincible_framenum);
			System.IO.BinaryWriter temp_BinaryWriter56;
			temp_BinaryWriter56 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter56.Write((System.Single) breather_framenum);
			System.IO.BinaryWriter temp_BinaryWriter57;
			temp_BinaryWriter57 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter57.Write((System.Single) enviro_framenum);
			
			System.IO.BinaryWriter temp_BinaryWriter58;
			temp_BinaryWriter58 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter58.Write((System.Int32) (grenade_blew_up?1:0));
			System.IO.BinaryWriter temp_BinaryWriter59;
			temp_BinaryWriter59 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter59.Write((System.Single) grenade_time);
			System.IO.BinaryWriter temp_BinaryWriter60;
			temp_BinaryWriter60 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter60.Write((System.Int32) silencer_shots);
			System.IO.BinaryWriter temp_BinaryWriter61;
			temp_BinaryWriter61 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter61.Write((System.Int32) weapon_sound);
			System.IO.BinaryWriter temp_BinaryWriter62;
			temp_BinaryWriter62 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter62.Write((System.Single) pickup_msg_time);
			System.IO.BinaryWriter temp_BinaryWriter63;
			temp_BinaryWriter63 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter63.Write((System.Single) flood_locktill);
			System.IO.BinaryWriter temp_BinaryWriter64;
			temp_BinaryWriter64 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter64.Write((System.Single) flood_when[0]);
			System.IO.BinaryWriter temp_BinaryWriter65;
			temp_BinaryWriter65 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter65.Write((System.Single) flood_when[1]);
			System.IO.BinaryWriter temp_BinaryWriter66;
			temp_BinaryWriter66 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter66.Write((System.Single) flood_when[2]);
			System.IO.BinaryWriter temp_BinaryWriter67;
			temp_BinaryWriter67 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter67.Write((System.Single) flood_when[3]);
			System.IO.BinaryWriter temp_BinaryWriter68;
			temp_BinaryWriter68 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter68.Write((System.Single) flood_when[4]);
			System.IO.BinaryWriter temp_BinaryWriter69;
			temp_BinaryWriter69 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter69.Write((System.Single) flood_when[5]);
			System.IO.BinaryWriter temp_BinaryWriter70;
			temp_BinaryWriter70 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter70.Write((System.Single) flood_when[6]);
			System.IO.BinaryWriter temp_BinaryWriter71;
			temp_BinaryWriter71 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter71.Write((System.Single) flood_when[7]);
			System.IO.BinaryWriter temp_BinaryWriter72;
			temp_BinaryWriter72 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter72.Write((System.Single) flood_when[8]);
			System.IO.BinaryWriter temp_BinaryWriter73;
			temp_BinaryWriter73 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter73.Write((System.Single) flood_when[9]);
			System.IO.BinaryWriter temp_BinaryWriter74;
			temp_BinaryWriter74 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter74.Write((System.Int32) flood_whenhead);
			System.IO.BinaryWriter temp_BinaryWriter75;
			temp_BinaryWriter75 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter75.Write((System.Single) respawn_time);
			f.writeEdictRef(chase_target);
			System.IO.BinaryWriter temp_BinaryWriter76;
			temp_BinaryWriter76 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter76.Write((System.Int32) (update_chase?1:0));
			
			System.IO.BinaryWriter temp_BinaryWriter77;
			temp_BinaryWriter77 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter77.Write((System.Int32) 8765);
		}
	}
}